package com.learn.springcloud.sleuthprovider.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @Time : 2018/8/16 16:00
 * @Version : 1.0
 */
@RestController
public class HelloController {

    @Autowired
    private RestTemplate restTemplate;

    @RequestMapping("/sleuth/service/provider/test1/{name}")
    public String sayHello(@PathVariable String name) {
        System.out.println("provider: " + name);
        String url = "http://sleuth-service-database/sleuth/service/database/test1/{1}";
        return restTemplate.getForObject(url, String.class, name);
    }

}
